using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Spinning.Spinning.Interface;

namespace Spinning.Spinning.EntityModifiers
{
    class PositionModifier : DoubleValueModifier
    {
     
        public PositionModifier(int startTime, int endTime, Vector2 from, Vector2 to)
            : base(startTime, endTime, from, to)
        {
        }

        protected override void onStart(IEntity item, EntityModifier modifier)
        {
            item.Position = _from;
        }

        protected override void onFinish(IEntity item, EntityModifier modifier)
        {
            item.Position = _to;
        }

        protected override void uptateEntity(IEntity item, float frames, int count)
        {
            Vector2 displacement = (_to - _from) / frames;
            item.Position = _from+displacement * count;
        }
    
}
}
